package truef.service.favoriteshop.service;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import edu.zut.cs.software.base.service.GenericGenerator;
import truef.favoriteshop.domain.Favorite;
import truef.favoriteshop.domain.Shop;

public class shopFavoriteEntityGenerator extends GenericGenerator{

	@Autowired
	ShopManager shopManager;
	
	@Autowired
	FavoriteManager favoriteManager;
	
	@Test
    public void gen_favorite(Favorite fa) {
        for (int i = 0; i < 2; i++) {
            Favorite f = new Favorite();
            f.setName("Favorite_" + i);
            this.favoriteManager.save(f);
            for (int j = 0; j < 2; j++) {
            	Favorite favorite = new Favorite();
                favorite.setName("favorite_" + i + "_" + j);
                favorite.setParent(f);
                f = this.favoriteManager.save(favorite);
                this.gen_favorite(f);
            }
        }
    }
	
	public void gen_shop(Shop s) {
		for (int i = 0; i < 2; i++) {
            Shop shop = new Shop();
            shop.setShopName("shopName_" + i);
            this.shopManager.save(shop);
        }
	}

}
